package com.snape.controller;

import com.snape.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * Created by liuqingcan_snape on 2017/4/2.
 */
@Controller
@RequestMapping(value = "video")
public class VideoController {
    @Autowired
    VideoService videoService;

    /**
     * 获得房间的所有视频(课程)信息
     * @param roomid
     * @return
     */
    @RequestMapping(value = "get_video_info",method = RequestMethod.POST)
    public @ResponseBody Map<String,Object>getAllVideoInfoByRoomIdAction(@RequestBody Map map){


        int roomid = -1;

        Object tempPageNumber = map.get("roomid");
        if ( tempPageNumber != null){
            roomid = Integer.parseInt(tempPageNumber.toString());
        }
        return videoService.getAllVideoInfoByRoomId(roomid);
    }
}